package com.lanyou.esb.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class FileDelCilent {

	public static boolean delBundleBySocket(String ip, String port, String fileName) {
		Socket client = null;
		OutputStream os = null;
		InputStream is = null;
		try {
			client = new Socket(ip, Integer.parseInt(port));
			os = client.getOutputStream();
			is = client.getInputStream();
			os.write(fileName.getBytes("utf-8"));
			byte[] delReturnStr = new byte[1024]; 
			is.read(delReturnStr);
			String str1 = new String(delReturnStr);
			if (str1.trim().equals("delOk")) {
				return true;
			}else{
				return false;
			}
		} catch (Exception e) {
			return false;
		} finally {
			try {
				os.close();
				is.close();
				client.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	
	
	/*public static void main(String[] args) {
		
		delBundleBySocket("172.26.142.135", "8887", "测试.jar");
	}*/
	
	

}
